import { createRouter, createWebHistory } from 'vue-router'
import HomePage from '../pages/HomePage.vue'
import UserLoginPage from '../pages/user/UserLoginPage.vue'
import UserRegisterPage from '../pages/user/UserRegisterPage.vue'
import UserManagePage from '../pages/admin/UserManagePage.vue'
import EquipmentManage from '@/pages/equipment/EquipmentManagePage.vue'
import Layout from '@/layouts/BasicLayout.vue'
import NoAuth from '@/layouts/NoAuth.vue'
import AddUserPage from '@/pages/AddUserPage.vue'
import AddEquipmentPage from '@/pages/equipment/addEquipmentPage.vue'
import CategoryManage from '@/pages/equipment/CategoryManage.vue'
import LabelManage from '@/pages/equipment/LabelManage.vue'
import OrdersManages from '@/pages/orders/OrdersManages.vue'
import CompanyMange from '@/pages/orders/CompanyManage.vue'
import EquipmentInformation from '@/pages/equipment/EquipmentInformation.vue'
import { ACCESS_ENUM } from '@/access/accessEnum.ts'
import FixEquipmentPage from '@/pages/equipment/FixEquipmentPage.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'Layout',
      component: Layout,
      children: [
        {
          path: '/',
          name: 'home',
          component: HomePage
        },
        {
          path: '/user/login',
          name: '用户登录',
          component: UserLoginPage
        },
        {
          path: '/user/register',
          name: '用户注册',
          component: UserRegisterPage
        },
        {
          path: '/admin/userManage',
          name: '用户管理',
          component: UserManagePage,
          meta: {
            access: ACCESS_ENUM.SYSTEM_ADMIN
          }
        },
        {
          path: '/equipment/equipmentManage',
          name: '设备管理',
          component: EquipmentManage
        },
        {
          path: '/user/add_user',
          name: '创建图片',
          component: AddUserPage
        },
        {
          path: '/equipment/add_equipment',
          name: '新增/修改设备',
          component: AddEquipmentPage
        },
        {
          path: '/category/categoryManage',
          name: '分类管理',
          component: CategoryManage
        },
        {
          path: '/label/labelManage',
          name: '标签管理',
          component: LabelManage
        },
        {
          path: '/orders/ordersManage',
          name: '订单管理',
          component: OrdersManages
        },
        {
          path: '/company/companyMange',
          name: '公司管理',
          component: CompanyMange
        },
        {
          path: '/equipment/equipmentInformation',
          name: '器材管理',
          component: EquipmentInformation
        },
        {
          path: 'fixEquipment/page',
          name: '维护页面',
          component: FixEquipmentPage
        }
      ]
    },
    {
      path: '/noAuth',
      name: '401无权限页面',
      component: NoAuth
    }
  ]
})

export default router
